﻿using IntelligentAgriculture.Contracts.Interface.SheepFileModelInterface;
using IntelligentAgriculture.Domain.Entity;
using IntelligentAgriculture.WebAPI.Application.Command.SheepfilemodelCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.SheepfilemodelCommandHandler
{
	/// <summary>
	/// 根据耳号反填养只档案
	/// </summary>
	/// <returns></returns>
	public class DteilSheepfilemodelCommandHandler : IRequestHandler<DteilSheepfilemodelCommand, Results<Sheepfilemodel>>
	{
		private readonly ISheepFileModelService _sheepFileModelService;
		public DteilSheepfilemodelCommandHandler(ISheepFileModelService sheepFileModelService)
		{
			_sheepFileModelService = sheepFileModelService;
		}
		/// <summary>
		/// 根据耳号反填养只档案
		/// </summary>
		/// <returns></returns>
		public async Task<Results<Sheepfilemodel>> Handle(DteilSheepfilemodelCommand request, CancellationToken cancellationToken)
		{
			var result= await _sheepFileModelService.DteilSheepfilemodel(request.eartag);
			return Results<Sheepfilemodel>.DataResult(result);
		}
	}
}
